﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShengHeList.aspx.cs" Inherits="PropertyAppraisal.ShengHeList" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link rel="stylesheet" type="text/css" href="../easyui/easyui/1.3.2/themes/default/easyui.css" />
    <link rel="stylesheet" type="/text/css" href="../easyui/easyui/1.3.2/themes/icon.css" />
    <script src="../easyui/easyui/1.3.2/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="../easyui/easyui/1.3.2/jquery.easyui.min.js"></script>
    <script src="../easyui/easyui/1.3.2/easyloader.js"></script>
    <script src="../easyui/easyui/1.3.2/locale/easyui-lang-zh_CN.js"></script>

</head>
<body>
    <div fit="true">
         <div style="padding: 3px">
            <input class="easyui-textbox" type="text" id="empname" data-options="required:true" placeholder="请输入项目号查询" />
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="cha()">查询</a>
                <iframe width="0" height="0" src="../SessionKeeper.aspx"></iframe>   
        </div>
        <table id="dg" title="审核列表" style="width: 1100px; height: 480px" data-options="
				rownumbers:true,
				singleSelect:true,
				autoRowHeight:false,
				pagination:true,
				pageSize:10">
            <thead>
                <tr>
                    <th field="xiangId" width="120">项目号</th>
                    <th field="shenRen" width="90">申请人</th>
                    <th field="kanRen" width="90">勘察员</th>
                    <th field="guRen" width="90" align="center">估价员</th>
                    <th field="houseAddr" width="150" align="center">房屋坐落</th>
                    <th field="size" width="90" align="center">建筑面积(m²)</th>
                    <th field="price" width="120">评估单价(元/m²)</th>
                    <th field="psum" width="90">评估总值(万元)</th>
                    <th field="states" width="100">状态</th>
                    <th field="cao" width="150">操作</th>
                </tr>
            </thead>
        </table>

    </div>
    <div id="win" style="display: none; padding-left: 20px;">
        审核意见：<br />
        <textarea name="message" style="height: 60px; width: 260px;"></textarea><br />
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok',toggle:true" id="tong">提交</a>
    </div>
    <script type="text/javascript">

        //跳转审核页面
        function chushen(id, state) {
            location.href = "/Auditing/ShengHePager.aspx?id=" + id + "&state=" + state;
        }
        //表格
        function getData(pid) {        
            var rows = [];
            $.ajax({
                type: "post", //要用post方式                 
                url: "ShengHeList.aspx/showKanCha",//方法所在页面和方法名
                data:"{'pid':'"+pid+"'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                async: false,
                success: function (result) {
                    var json = eval("(" + result.d + ")");
                    for (var i = 0; i < json.length; i++) {
                        rows.push({
                            xiangId: json[i].projectNumber,
                            shenRen: json[i].loan_Name, //$.fn.datebox.defaults.formatter(new Date()),
                            kanRen: json[i].survey,
                            guRen: json[i].evaluation,
                            houseAddr: json[i].house_Located,
                            size: json[i].basic_Acreage,
                            price: json[i].basic_UnitPrice,
                            psum: json[i].basic_Total,
                            states: json[i].basic_State == 0 ? "保存未提交" : json[i].basic_State == 1 ? "已提交/待勘察" : json[i].basic_State == 2 ? "勘察中" : json[i].basic_State == 3 ? "已勘察/待评估" : json[i].basic_State == 4 ? "评估进行中" : json[i].basic_State == 5 ? "已评估/待初审" : json[i].basic_State == 6 ? "初审未通过" : json[i].basic_State == 7 ? "初审通过" : json[i].basic_State == 8 ? "终审未通过" : "终审通过",
                            cao: json[i].basic_State == 5 ? '<a href="javascript:void(0) " class="easyui-linkbutton" onclick="chushen(' + json[i].projectNumber + ',' + json[i].basic_State + ')" >初审</a> <a disabled href="javascript:void(0) " class="easyui-linkbutton" onclick="zhongshen()" >终审</a> ' : json[i].basic_State == 7 ? '<a disabled href="javascript:void(0) " class="easyui-linkbutton" onclick="chushen(json[i].basic_State)" >初审</a> <a  href="javascript:void(0) " class="easyui-linkbutton" onclick="chushen(' + json[i].projectNumber + ',' + json[i].basic_State + ')" >终审</a> ' : '<a href="javascript:void(0)" disabled class="easyui-linkbutton" onclick="chushen(json[i].basic_State)" >初审</a> <a disabled href="javascript:void(0) " class="easyui-linkbutton" onclick="zhongshen()" >终审</a> '
                        });
                    }
                }
            })
            return rows;
        }
        function pagerFilter(data) {
            if (typeof data.length == 'number' && typeof data.splice == 'function') {	// is array
                data = {
                    total: data.length,
                    rows: data
                }
            }
            var dg = $(this);
            var opts = dg.datagrid('options');
            var pager = dg.datagrid('getPager');
            pager.pagination({
                onSelectPage: function (pageNum, pageSize) {
                    opts.pageNumber = pageNum;
                    opts.pageSize = pageSize;
                    pager.pagination('refresh', {
                        pageNumber: pageNum,
                        pageSize: pageSize
                    });
                    dg.datagrid('loadData', data);
                }
                ,
                onRefresh: function (pageNum, pageSize) {
                    var pid = $("#empname").val();
                    $('#dg').datagrid({ loadFilter: pagerFilter }).datagrid('loadData', getData(pid));
                }
            });
            if (!data.originalRows) {
                data.originalRows = (data.rows);
            }
            var start = (opts.pageNumber - 1) * parseInt(opts.pageSize);
            var end = start + parseInt(opts.pageSize);
            data.rows = (data.originalRows.slice(start, end));
            return data;
        }

        //查询
        $(function () {
            var pid = $("#empname").val();
            $('#dg').datagrid({ loadFilter: pagerFilter }).datagrid('loadData', getData(pid));
        });

        function cha()
        {
            var pid = $("#empname").val();
            $('#dg').datagrid({ loadFilter: pagerFilter }).datagrid('loadData', getData(pid));
        }
    </script>
</body>
</html>
